﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;

namespace qna.Business {
	public class Student : User {

		public int UserId { get; set; }
		public string Course { get; set; }
		public int Semester { get; set; }

		protected override string TableName { get { return "student"; } }
		protected override string PrimaryKey { get { return "user_id"; } }

		protected override BusinessObject New() {
			return new Student();
		}

		public override IDictionary<string, object> Attributes {
			get {
				IDictionary<string, object> attrs = base.Attributes;
				attrs["user_id"] = UserId;
				attrs["Course"] = Course;
				attrs["Semester"] = Semester;
				return attrs;
			}
		}

		public override void ReadAttributes(SqlDataReader dr) {
			base.ReadAttributes(dr);
			UserId = (int)dr["user_id"];
			Course = dr["Course"].ToString();
			Semester = Convert.ToInt32(dr["Semester"]);
		}
	}
}